<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'edit_sys_user_info.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/style.css?v=4.1.0" rel="stylesheet">
<link
	href="${ctx}/css/plugins/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<!-- bootstrap-switch css -->
<link href="${ctx }/css/plugins/bootstrap-switch/bootstrap-switch.css"
	rel="stylesheet">
<style type="text/css">
body {
	background: none;
}

</style>
</head>
<body>

	<div class="inmodal" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content animated bounceInRight">
				<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h5 class="modal-title">编辑元件配置</h5>
				</div>
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="editTaskForm"  name="editTaskForm">
					    <input id="pk_task_id" name="pk_task_id" type="hidden" value="${jobDetailModel.pk_task_id}">
						<input id="pk_dict_id" name="pk_dict_id" type="hidden" value="${jobDetailModel.pk_dict_id}">
						<input id="pk_scene_id" name="pk_scene_id" type="hidden" value="${jobDetailModel.pk_scene_id}">
						<input id="jobGroup" name="jobGroup" type="hidden" value="${jobDetailModel.jobGroup}">
						<div class="form-group">
							<label class="col-sm-3 control-label">任务名称：</label>
							<div class="col-sm-8">
								<input id="jobName" name="jobName" class="form-control"
									required="" aria-required="true" type="text" value="${jobDetailModel.jobName}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">监控时间：</label>
							<div class="col-sm-8">
								<select class="selectpicker" required="" aria-required="true"
									name="cronExpression" id="cronExpression">
									<option value="0 */1 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */1 * * * ?'}">selected</c:if>>每隔1分钟执行一次</option>
									<option value="0 */2 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */2 * * * ?'}">selected</c:if>>每隔2分钟执行一次</option>
									<option value="0 */3 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */3 * * * ?'}">selected</c:if>>每隔3分钟执行一次</option>
									<option value="0 */5 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */5 * * * ?'}">selected</c:if>>每隔5分钟执行一次</option>
									<option value="0 */10 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */10 * * * ?'}">selected</c:if>>每隔10分钟执行一次</option>
									<option value="0 */15 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */15 * * * ?'}">selected</c:if>>每隔15分钟执行一次</option>
									<option value="0 */30 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */30 * * * ?'}">selected</c:if>>每隔30分钟执行一次</option>
									<option value="0 */60 * * * ?" <c:if test="${jobDetailModel.cronExpression eq '0 */60 * * * ?'}">selected</c:if>>每隔60分钟执行一次</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">接口类：</label>
							<div class="col-sm-8">
								<select class="selectpicker" required="" aria-required="true"
									name="jobClassName" id="jobClassName">
									<option value="">--请选择--</option>
									<c:forEach items="${list}" var="dictInfo">
										<option value="${dictInfo.dictcode}" <c:if test="${jobDetailModel.jobClassName eq dictInfo.dictcode}">selected</c:if>>${dictInfo.dictname}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-3 control-label">起始系统：</label>
							<div class="col-sm-8">
								<input id="initial_system" name="initial_system" class="form-control"
									 type="text" value="${jobDetailModel.initial_system}">
							</div>
						</div>
							<div class="form-group">
							<label class="col-sm-3 control-label">目标系统：</label>
							<div class="col-sm-8">
								<input id="target_system" name="target_system" class="form-control"
									 type="text" value="${jobDetailModel.target_system}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">监控开关：</label>
							<div class="col-sm-2">
								<div class="switch has-switch">
									<div id="share_switch_div" class="switch-on switch-animate">
										<input id="share_switch_input" name="share_switch_input"
											type="checkbox" checked="checked">
									</div>
								</div>
								<input id="monit_switch" name="monit_switch" type="hidden">
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button type="button" class="btn btn-white closeWin" data-dismiss="modal">关闭</button>
								<button type="submit" class="btn btn-primary">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- 全局js -->
	<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>

	<!-- Peity -->
	<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>

	<!-- jqGrid -->
	<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
	<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

	<!-- jQuery Validation plugin javascript-->
	<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>

	<!-- layer javascript -->
	<script src="${ctx }/js/plugins/layer/layer.min.js"></script>
	<!-- jQuery form-->
	<script src="${ctx }/js/jquery.form.js"></script>

	<!-- 自定义js ---->
	<script src="${ctx }/js/content.js"></script>
	<script src="${ctx }/js/plugins/layer/laydate/laydate.js"></script>
		<script src="${ctx }/js/jquery.base64.js"></script>
	<script
		src="${ctx}/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
	<!-- bootstrap-switch js -->
	<script src="${ctx }/js/plugins/bootstrap-switch/bootstrap-switch.js"></script>
	<script type="text/javascript">
		//绑定修改表单提交事件,异步提交表单
		$('.closeWin').click(function() {
			window.parent.editWinClose('1');
		});
		$("#editTaskForm").submit(function() {
			$.ajax({
				type : "post",
				url : "${ctx }/scheduler/task/doEditJob",
				data : $('#editTaskForm').serialize(),
				datatype : "json",
				success : function(data) {
					if (data.errcode == '0') {
						layer.alert(data.errmsg, {
							icon : 1
						}, function(index) {

							window.parent.editWinClose('0');
							//关闭提示框
						});
					} else {
						layer.alert("保存失败！", {
							icon : 2
						});
					}
				}
			});

			return false;
		});
		var v_monit_switch ="${jobDetailModel.monit_switch}";
		var v_switch;
		if(v_monit_switch==1){
			v_switch=true;
		}else{
			v_switch=false;
		}
		//监控开关
		$('#share_switch_div input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : v_switch,
			onInit : function(event, state) {//初始化开关
				$("#monit_switch").val(v_monit_switch);
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#monit_switch").val("1");
				} else {
					$("#monit_switch").val("0");
				}
			}
		});
	</script>
</body>
</html>
